<%@page import="powerdev.negocio.GestionServicio"%>
<%@page import="powerdev.modelo.Servicio"%>
<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>
<%@page import="powerdev.negocio.GestionLocal,java.util.*"%>
<%@page import="powerdev.modelo.Local, powerdev.modelo.Servicio"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body,td,th {
	font-family: Georgia, "Times New Roman", Times, serif;
}
</style>
<script language="JavaScript" type="text/JavaScript">

  	 function SeleccionarHoras() {
					var e = document.getElementById("CantHoras");
					var strUser = e.options[e.selectedIndex].value;
					var pre =document.form1.Txt_PreHora.value;
					
					var tot =strUser*pre;
					
				//	alert(tot);
				
				
    				document.form1.Txt_Importe.value=  tot;
    		
	}
			
  	 
	function Seleccionar() {
					
					 		document.form1.action="ListarDatosLocal_Cancha";
    					    document.form1.method="post";
	 						document.form1.submit();
					}
					
	function getDatos(obj){
						
        var m = obj.rowIndex; 
      //  alert("Row Index: "+m);
        
						var oTable = document.getElementById('tblDetalle');
    //gets table
    var rowLength = oTable.rows.length;
    //gets rows of table

    //for (i = 0; i < rowLength; i++){
    //loops through rows
       var oCells = oTable.rows.item(m).cells;
       //gets cells of current row
      // var cellLength = oCells.length;
       
        document.form1.Txt_CodCancha.value=oCells.item(0).innerHTML;
        document.form1.Txt_NomCancha.value=oCells.item(1).innerHTML;
        document.form1.Txt_TipoCancha.value=oCells.item(3).innerHTML;
        document.form1.Txt_Fecha.value=oCells.item(4).innerHTML;
        document.form1.Txt_HoraI.value=oCells.item(5).innerHTML;
        document.form1.Txt_Importe.value=document.form1.Txt_PreHora.value;
   }
</script>
</head>
	<% 
      GestionLocal neg = new GestionLocal();
	  Collection<Local> todos = neg.ListarLocales();
   	  request.setAttribute("ListadoLocal",todos);
   	  
   	  GestionServicio nes=new GestionServicio();
   	  //Collection<Servicio> servicios=nes.ListarServicios();
   	 // request.setAttribute("ListadoServicio", servicios);
   	  
  	 %>
  	 
<body>
	<table width="100%" border="0">
		<tr>
			<td height="39" align="center" bgcolor="#FFFFCC"><h3>
					<strong>ALQUILER DE CANCHA DE FULBITO</strong>
				</h3></td>
		</tr>
		<tr>
			
		</tr>
		<tr>
			<td height="167" style="height: 12px;">
			<form name="form1" method="get" action="RegistrarAlquileres">
					<table width="100%" border="0" style="height: 765px;">
						<tr>
							
						</tr>
						<tr>
							<td height="59" style="height: 195px;"><table width="98%" border="0" align="center">
									<tr>
										<td height="30" colspan="2" bgcolor="#99FF00" style="height: 18px;"><h4>CARGA INFORMACIÓN DEL
												LOCAL Y CANCHA:</h4></td>
									</tr>
									<tr>
										<td width="26%">Seleccione un Local:</td>
										<td width="74%" style="width: 525px;">
						<select name="cmbLocal" id="cmbLocal" onchange="javascript:Seleccionar();" style="width: 335px;">
												<option value="0">Seleccione un Local</option>
												<%
 				for(Local c:todos){
 				   out.println("<option value="+c.getCo_Local()+">"+c.getNo_Local()+"</option>"); 
				}
 			  %>

										</select></td>
									</tr>
									<tr>
										<td>Dirección:</td>
										<td><input name="Txt_NumDoc2" type="text" id="Txt_NumDoc2" value="${TXDireccion}" style="width: 627px;" /></td>
									</tr>
								</table></td>
						</tr>
						<tr>
							<td><input type="hidden" id="__sf" name="__sf" value="" />
								<input type="hidden" id="__so" name="__so" value="" />
								<table id="tblDetalle" cellspacing="3" cellpadding="4" border="1" name="tblDetalle">
									<tr style="background-color:#DCDCDC;">
										<td>Código</td>
										<td>Nombre de Cancha</td>
										<td>Característica</td>
										<td>Tipo</td>
										<td>Fecha</td>
										<td>Hora Inicio</td>
										<td>Hora Fin</td>
									</tr>

										${Resultado}

								</table>
						</td></tr>
						<tr>
							<td><p>DETALLE DE ALQUILER:</p>
								<table width="98%" border="0">
									<tr>
										<td bgcolor="#FFFFCC" style="width: 132px;">Código de Cancha:</td>
										<td bgcolor="#FFFFCC" style="width: 659px;"><input name="Txt_CodCancha" type="text" id="Txt_CodCancha" value="" style="width: 70px;" /></td>
									</tr>
									<tr>
										<td bgcolor="#FFFFCC" style="width: 132px;">Nombre de Cancha:</td>
										<td bgcolor="#FFFFCC" style="width: 659px;"><input name="Txt_NomCancha" type="text" id="Txt_NomCancha" value="" style="width: 601px;" /></td>
									</tr>
									<tr>
										<td bgcolor="#FFFFCC">Tipo:</td>
										<td bgcolor="#FFFFCC"><input name="Txt_TipoCancha" type="text" id="Txt_TipoCancha" value="" style="width: 248px;" /></td>
										
										
										
									</tr>
									<tr>
										<td bgcolor="#FFFFCC">Fecha:</td>
										<td bgcolor="#FFFFCC"><input name="Txt_Fecha" type="text" id="Txt_Fecha" value="2012-04-13" style="width: 140px;" /></td>
									</tr>
									<tr>
										<td bgcolor="#FFFFCC">Precio x Hora S/.:</td>
										<td bgcolor="#FFFFCC"><input name="Txt_PreHora" type="text" id="Txt_PreHora" value="25.00" style="width: 140px;" /></td>
									</tr>
									<tr>
										<td bgcolor="#FFFFCC">Hora Inicio</td>
										<td bgcolor="#FFFFCC"><input name="Txt_HoraI" type="text" id="Txt_HoraI" value="16:00:00" style="width: 140px;" /></td>
									</tr>
									<tr>
										<td bgcolor="#FFFFCC">Cantidad Horas:</td>
										<td bgcolor="#FFFFCC">
										<select name="CantHoras" id="CantHoras" onchange="javascript:SeleccionarHoras();" style="width: 142px;">
												<option value="1">1</option>
												<option value="2">2</option>
												<option value="3">3</option>
												<option value="4">4</option>
												<option value="5">5</option>
												<option value="6">6</option>
										</select></td>
									</tr>
									<tr>
										<td bgcolor="#FFFFCC">Importe S/.:</td>
										<td bgcolor="#FFFFCC"><input name="Txt_Importe" type="text" id="Txt_Importe" value="0.00" style="width: 140px;" /></td>
									</tr>

								</table></td>
						</tr>
						<tr>
							
						</tr>
						<tr>
							

						</tr>
						<tr>
							<td>
								<table width="98%" border="0" style="height: 47px; width: 516px">
									<tr>
										<td><input type="submit" name="btnGuardar" id="btnGuardar" value="Enviar" style="width: 202px;" /></td>
										<td><input type="submit" name="btnCancelar" id="btnCancelar" value="Cancelar" style="width: 202px;" /></td>
									</tr>

								</table>
							</td>

						</tr>
					</table>
					${MENSAJE}
				</form></td>
		</tr>
	</table>
</body>
</html>